/*
 * @Descripttion: 
 * @Author: yubo
 * @Date: 2022-08-30 17:28:15
 * @LastEditTime: 2022-08-30 17:40:08
 */
#pragma once
#include "Common.h"
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/pem.h>
#include <mutex>
#include <vector>

// thread safe
class rsa
{
public:
	// clear and public_key must be text not binary
	static std::string encrypt(const std::string &clear, const std::string &public_key);
	static std::string decrypt(const std::string &clear, const std::string &private_key);
	static auto id_function() -> unsigned long { return syscall(__NR_gettid); }
	static auto locking_function(int, int, const char *, int) -> void;
private:
	static std::vector<std::mutex> vectorOfSslMutex;
};